<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;

class CmsFieldTypeSeeder extends Seeder
{
    /**
     * Run the database seeds.
     * php artisan db:seed --class=CmsFieldTypeSeeder
     * @return void
     */
    public function run()
    {
        $datas = [
            ['type' => 'number', 'label' => '数字框', 'status' => 'normal'],
            ['type' => 'text', 'label' => '输入框', 'status' => 'normal'],
            ['type' => 'switch', 'label' => '开关按钮', 'meta' => '{"multiple": true}', 'status' => 'normal'],
            ['type' => 'select', 'label' => '单选框', 'meta' => '{"multiple": true}', 'status' => 'normal'],
            ['type' => 'password', 'label' => '密码框', 'status' => 'normal'],
            ['type' => 'checkbox', 'label' => '多选框', 'meta' => '{"multiple": true}', 'status' => 'normal'],
            ['type' => 'textarea', 'label' => '文本框', 'status' => 'normal'],
            ['type' => 'textimg', 'label' => '图文框', 'status' => 'normal'],
            ['type' => 'datepicker', 'label' => '日期选择', 'status' => 'normal'],
            ['type' => 'timepicker', 'label' => '时间选择', 'status' => 'normal'],
            ['type' => 'videoupload', 'label' => '视频上传 ( 单选 )', 'status' => 'normal'],
            ['type' => 'videosupload', 'label' => '视频上传 ( 多选 )', 'status' => 'normal'],
            ['type' => 'imageupload', 'label' => '图片上传 ( 单选 )', 'status' => 'normal'],
            ['type' => 'imagesupload', 'label' => '图片上传 ( 多选 )', 'status' => 'normal'],
            ['type' => 'fileupload', 'label' => '文件上传 ( 单选 )', 'status' => 'normal'],
            ['type' => 'filesupload', 'label' => '文件上传 ( 多选 )', 'status' => 'normal']
        ];

        foreach ($datas as $v) {
            \Project\Cms\Models\CmsFieldType::updateOrCreate(
                [
                    'type' => $v['type'],
                ],
                $v
            );
        }
    }
}
